
import React, { useEffect } from 'react';
import { connect, } from 'umi';
import { Button } from 'antd';

const Home = (props) => {
    const { baseInfo, dispatch } = props;

    useEffect(() => {
        dispatch({
            type: 'baseInfo/getBaseInfo',
        }).then(res => {
            console.log('res', res)
        })
    }, [])

    const handleClick = () => {
        console.log('click')
        dispatch({
            type: 'baseInfo/updateBaseInfo',
        })
    }

    return <div onClick={handleClick}>
        Home - {baseInfo && baseInfo.name}
        <Button type='primary'>111</Button>
    </div>
};

export default connect(({ baseInfo }) => ({
    baseInfo,
}))(Home);